package Model;

import java.awt.Image;
import java.io.Serializable;
import java.util.Date;

//Class for the a contact

/**
 * The model for a contact with all its attributes, accessors, mutators, toString and equals methods
 * 
 */

public class Contact implements Serializable {

	//Global variables
	public static final String FIRSTNAME = "First name: ";
	public static final String LASTNAME= "Last Name: ";
	public static final String GROUP = "Group: " ;
	public static final String HOMEADDRESS = "Home Address: ";
	public static final String COMPANYNAME = "Company Name: ";
	public static final String COMPANYADDRESS = "Company Address: ";
	public static final String PERSPHONE = "Personal Phone: ";
	public static final String PROPHONE = "Professional Phone: ";
	public static final String WEBSITE = "Web Site: ";
	public static final String EMAIL = "Email: ";
	public static final String BIRTHDATE = "Birthdate: ";
	public static final String IMAGE = "Image: ";
	public static final String DATE ="Date: ";
	public static final String SEMICOLON = " ; ";
	public static final String COLON =" : ";
	public static final String COMMA =", ";
	
	public static final String HTML_BEGIN = "<html>";
	public static final String HTML_END ="</html>";
	public static final String LINK_BEGIN ="<a href=\"";
	public static final String LINK_END ="\">";
	public static final String LINK_BALISE_END ="</a>";
	public static final String NEXT_LIGNE = "<br>";
	
	
	
	
	private static final long serialVersionUID = 1L;
	
	private String FirstName,LastName,Group, HomeAddress,CompanyName,CompanyAddress,PersPhone,ProPhone,WebSite,Email,BirthDate,ImgURL;
	Date date;
	public String getFirstName() {
		return FirstName;
	}
	public void setFirstName(String firstName) {
		FirstName = firstName;
	}
	public String getLastName() {
		return LastName;
	}
	public void setLastName(String lastName) {
		LastName = lastName;
	}
	public String getGroup() {
		return Group;
	}
	public void setGroup(String group) {
		Group = group;
	}
	public String getHomeAddress() {
		return HomeAddress;
	}
	public void setHomeAddress(String homeAddress) {
		HomeAddress = homeAddress;
	}
	public String getCompanyName() {
		return CompanyName;
	}
	public void setCompanyName(String companyName) {
		CompanyName = companyName;
	}
	public String getCompanyAddress() {
		return CompanyAddress;
	}
	public void setCompanyAddress(String companyAddress) {
		CompanyAddress = companyAddress;
	}
	public String getPersPhone() {
		return PersPhone;
	}
	public void setPersPhone(String persPhone) {
		PersPhone = persPhone;
	}
	public String getProPhone() {
		return ProPhone;
	}
	public void setProPhone(String proPhone) {
		ProPhone = proPhone;
	}
	public String getWebSite() {
		return WebSite;
	}
	public void setWebSite(String webSite) {
		WebSite = webSite;
	}
	public String getEmail() {
		return Email;
	}
	public void setEmail(String email) {
		Email = email;
	}
	public String getBirthDate() {
		return BirthDate;
	}
	public void setBirthDate(String birthDate) {
		BirthDate = birthDate;
	}
	public String getImgURL() {
		return ImgURL;
	}
	public void setImgURL(String imgURL) {
		ImgURL = imgURL;
	}
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public Contact(String firstName, String lastName, String group,
			String homeAddress, String companyName, String companyAddress,
			String persPhone, String proPhone, String webSite, String email,
			String birthDate, String imgURL, Date date) {
		super();
		FirstName = firstName;
		LastName = lastName;
		Group = group;
		HomeAddress = homeAddress;
		CompanyName = companyName;
		CompanyAddress = companyAddress;
		PersPhone = persPhone;
		ProPhone = proPhone;
		WebSite = webSite;
		Email = email;
		BirthDate = birthDate;
		ImgURL = imgURL;
		this.date = date;
	}


	@Override
	public String toString() {
		
		StringBuilder strBuild = new StringBuilder();
		strBuild.append(FIRSTNAME).append(FirstName).append(COMMA+LASTNAME).append(LastName);
		strBuild.append(COMMA+GROUP).append(Group).append(COMMA+HOMEADDRESS).append(HomeAddress);
		strBuild.append(COMMA+COMPANYNAME).append(CompanyName).append(COMMA+COMPANYADDRESS).append(CompanyAddress);
		strBuild.append(COMMA+PERSPHONE).append(PersPhone).append(COMMA+PROPHONE).append(ProPhone);
		strBuild.append(COMMA+WEBSITE).append(WebSite).append(COMMA+EMAIL).append(Email);
		strBuild.append(COMMA+BIRTHDATE).append(BirthDate).append(COMMA+DATE).append(date).append(IMAGE).append(ImgURL);
		
		return strBuild.toString();
		
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Contact other = (Contact) obj;
		if (BirthDate == null) {
			if (other.BirthDate != null)
				return false;
		} else if (!BirthDate.equals(other.BirthDate))
			return false;
		if (CompanyAddress == null) {
			if (other.CompanyAddress != null)
				return false;
		} else if (!CompanyAddress.equals(other.CompanyAddress))
			return false;
		if (CompanyName == null) {
			if (other.CompanyName != null)
				return false;
		} else if (!CompanyName.equals(other.CompanyName))
			return false;
		if (Email == null) {
			if (other.Email != null)
				return false;
		} else if (!Email.equals(other.Email))
			return false;
		if (FirstName == null) {
			if (other.FirstName != null)
				return false;
		} else if (!FirstName.equals(other.FirstName))
			return false;
		if (Group == null) {
			if (other.Group != null)
				return false;
		} else if (!Group.equals(other.Group))
			return false;
		if (HomeAddress == null) {
			if (other.HomeAddress != null)
				return false;
		} else if (!HomeAddress.equals(other.HomeAddress))
			return false;
		if (LastName == null) {
			if (other.LastName != null)
				return false;
		} else if (!LastName.equals(other.LastName))
			return false;
		if (PersPhone == null) {
			if (other.PersPhone != null)
				return false;
		} else if (!PersPhone.equals(other.PersPhone))
			return false;
		if (ProPhone == null) {
			if (other.ProPhone != null)
				return false;
		} else if (!ProPhone.equals(other.ProPhone))
			return false;
		if (WebSite == null) {
			if (other.WebSite != null)
				return false;
		} else if (!WebSite.equals(other.WebSite))
			return false;
		if (date == null) {
			if (other.date != null)
				return false;
		} else if (!date.equals(other.date))
			return false;
		return true;
	}
	
	
	
}
